<template>
  <div style="width:100%;background-color:#fff;">
    <div class="container">
      <!-- <build-el-bread></build-el-bread> -->
      <build-el-h1 name="参选人展示.png"></build-el-h1>
      <div class="w100 report flex-al">
        <build-el-report-list
          v-for="item in tableData "
          :key="item.newsId"
          :showDot="false"
          type="2"
          @handNes="handNes(item.newsId,item)"
          :title="item.title"
          :update-time="item.updateTime"
        ></build-el-report-list>

        <el-pagination
          v-margin-top="'10px'"
          background
          :page-size="pageSize"
          :current-page="pageNow"
          layout="prev, pager, next"
          @current-change="changePage"
          :total="total"
        ></el-pagination>
      </div>
      <div v-margin-top="'30px'"></div>
    </div>
  </div>
</template>
<script>
import buildElBread from '@/components/build-el-bread'
import buildElReportList from '@/components/build-el-report-list'
import buildElH1 from '@/components/build-el-h1'
export default {
  components: {
    buildElBread,
    buildElReportList,
    buildElH1,
  },
  data() {
    return {
      tableData: null,
      total: 0,
      pageSize: 15,
      pageNow: 1,
    }
  },
  async created() {
    await this.init(1)
  },
  methods: {
    handNes(id, item) {
      if (item.pcJumpLink != null) {
        window.open(item.pcJumpLink)
      } else if (item.mobileJumpLink != null) {
        window.open(item.mobileJumpLink)
      } else {
        this.toPage(id)
      }
      console.log('www', id)
    },
    async init(page) {
      this.tableData = []
      let tableData = await this.api.selectNewsList7(page, this.pageSize)
      this.total = tableData.total
      this.tableData = tableData.list
      console.log('tableData', this.tableData)
    },
    changePage(e) {
      this.pageNow = e
      this.init(e)
    },
  },
}
</script>
<style lang="less" scoped>
html {
  background: #eee;
}
.report {
  background: #fff;
  // height: 1000px;
}
</style>
